/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.pacis.shca.domain.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author solriver
 */
@Entity
@Table(name = "nombre_socioeconomico", catalog = "bdshca")
@NamedQueries({
    @NamedQuery(name = "NombreSocioeconomico.findAll", query = "SELECT n FROM NombreSocioeconomico n"),
    @NamedQuery(name = "NombreSocioeconomico.findByIdNombreSocioeconomico", query = "SELECT n FROM NombreSocioeconomico n WHERE n.idNombreSocioeconomico = :idNombreSocioeconomico"),
    @NamedQuery(name = "NombreSocioeconomico.findByNsoNombre", query = "SELECT n FROM NombreSocioeconomico n WHERE n.nsoNombre = :nsoNombre"),
    @NamedQuery(name = "NombreSocioeconomico.findByNsoValor", query = "SELECT n FROM NombreSocioeconomico n WHERE n.nsoValor = :nsoValor")})
public class SocioEconomicName implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_nombre_socioeconomico")
    private Integer id;
    @Column(name = "nso_nombre")
    private String name;
    @Column(name = "nso_valor")
    private Short value;
    @JoinColumn(name = "tso_id_tipo_socioeconomico", referencedColumnName = "id_tipo_socioeconomico")
    @ManyToOne(optional = false)
    private SocioEconomicType socioEconomicType;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "socioEconomicName")
    private List<SocioEconomicData> socioEconomicData;

    public SocioEconomicName() {
    }

    public SocioEconomicName(Integer idNombreSocioeconomico) {
        this.id = idNombreSocioeconomico;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer idNombreSocioeconomico) {
        this.id = idNombreSocioeconomico;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Short getValue() {
        return value;
    }

    public void setValue(Short value) {
        this.value = value;
    }

    public SocioEconomicType getSocioEconomicType() {
        return socioEconomicType;
    }

    public void setSocioEconomicType(SocioEconomicType socioEconomicType) {
        this.socioEconomicType = socioEconomicType;
    }

    public List<SocioEconomicData> getSocioEconomicData() {
        return socioEconomicData;
    }

    public void setSocioEconomicData(List<SocioEconomicData> socioEconomicData) {
        this.socioEconomicData = socioEconomicData;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SocioEconomicName)) {
            return false;
        }
        SocioEconomicName other = (SocioEconomicName) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.pacis.shca.domain.entity.SocioEconomicName[ id=" + id + " ]";
    }
    
}
